package com.etc.service;

import com.etc.dao.CheckOutDao;
import com.etc.entity.Checkout;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CheckOutServiceImpl implements CheckOutService{
    @Autowired
    CheckOutDao dao;

    @Override
    public PageInfo<Checkout> getAllCHK(int pageNum, int pageSize) {
        //1.开始分页
        PageHelper.startPage(pageNum, pageSize);
        //2.执行查询所有用户信息
        List<Checkout> list = dao.queryAllChk();
        //3.通过pageInfo进行包装,PageInfo包含了非常丰富的分页属性
        PageInfo<Checkout> pageInfo = new PageInfo<Checkout>(list);
        return pageInfo;
    }
}
